package 算术基本定理.完美数;

/**
 * TODO
 *
 * @className: wms
 * @description: TODO
 * @author: 等什么柠檬君
 * @date: 2022-05-06 21:27
 **/
public class wms {
    public static void main(String[] args) {
        System.out.println(checkPerfectNumber(7));

    }
    public static boolean checkPerfectNumber(int num) {
        if(num == 1) {
            return false;
        }
        int sum = 0;
        for (int i = 2; i <= Math.sqrt(num); ++i) {
            if (num % i == 0 && i != num){
                System.out.println(i+", "+num/i);
                sum += i;
                sum += num/i;
            }
        }
        return sum+1 == num;
    }
}
